<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:70:"/home/wwwroot/www.xgw0851.com/application/index/view/goods/detail.html";i:1528295993;s:69:"/home/wwwroot/www.xgw0851.com/application/index/view/public/base.html";i:1527951132;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="__PUBLIC__/xsd/css/mui.min.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/app.css?v1111" />

</head>
<!--/head-->
<body>


	<!--/header-->

<style>
    .mui-row.mui-fullscreen>[class*="mui-col-"] {
        height: 100%;
    }

    .mui-col-xs-3,
    .mui-col-xs-9 {
        overflow-y: auto;
        height: 100%;
    }

    .mui-segmented-control .mui-control-item {
        line-height: 50px;
        width: 100%;
    }

    .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
        background-color: #fff;
    }
    .mui-toast-container {
        bottom: 50%;
    }

    .mui-card .mui-control-content {
      padding: 10px;
    }

    .mui-control-content {
      height: 600px;
    }

    .mui-table-view .mui-media-object {
         line-height: 100px;
         max-width: 100px;
        height: 100px;
        width: 33.333333%
    }


    .mui-col-sm-3{
      width: 33.3333333%;
    }
    .price{
      color: #f60;
      font-size: 0.475342rem;
    }

    .mui-table-view-cell.mui-active{
        background-color: #fff
    }
    .mui-numbox{
      height: 25px;
      margin-top: 5px;
    }
    .mui-card img{
      width: 100%;
    }
    .foodprice::before {

    content: '';

}
</style>
<header class="mui-bar mui-bar-nav" style="z-index:7">
      <a class=" mui-icon mui-icon-home mui-pull-left"  href="<?php echo url('index/index/delivery'); ?>"></a>
      <h1 class="mui-title"><?php echo $info['good_name']; ?></h1>
      <a class="mui-icon mui-icon-contact mui-pull-right" href="<?php echo url('index/user/index'); ?>"></a>
</header>
<div class="mui-content"  >
  <img  src="<?php echo get_cover($info['cover_id'],'path'); ?>" style="width:100%;max-height: 250px;" data-preview-src="" data-preview-group="<?php echo $info['id']; ?>">
  <div class="mui-card" >
  				<div class="mui-card-header" style="display: block;" >
            <?php echo $info['good_name']; ?>
            <p>
              <?php echo $info['good_brief']; ?>
            </p>
            <p style="overflow: hidden;    margin-bottom: 15px;">
              <?php 
                 $priceArr = array();
                 foreach($info['goodsrule'] as $data){
                    $priceArr[]= $data['rule_price'];
                 }
                 $minPrice = min($priceArr);

                 if(count($priceArr) > 1){
                      $minPriceHtml = "<span>".$minPrice."</span><span class='foodprice-lowest'>起</span>";
                 }else{
                    $minPriceHtml = "<span>".$minPrice."</span>";
                 }
               ?>
            <strong class="foodprice" style="bottom: 10px;   left:15px; "><span style="color:#000;font-weight: normal;font-size:12px;">团购价 </span>
              <?php if(strtotime(config('grouptime')) > time()): ?>
                                                ¥<?php echo $minPriceHtml; else: ?>
                                            ¥<?php echo $minPriceHtml; endif; ?>
<span style="color:#000;font-weight: normal;font-size:12px;">市场价 </span><del style="color:#666;font-size:12px;font-weight: normal;">¥<?php echo $info['goodsrule'][0]['market_price']; ?></del></strong>
            </p>

            <div class="mask mask-transition" style="display:none;">
                <div class="wrap">
                    <div class="container">
                        <div class="specpanel">
                            <h1><?php echo $info['good_name']; ?></h1>
                            <div class="candidators">
                                <div class="candidators-group">
                                    <h2>规格</h2>
                                      <?php if(is_array($info['goodsrule']) || $info['goodsrule'] instanceof \think\Collection): $i = 0; $__LIST__ = $info['goodsrule'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$voo): $mod = ($i % 2 );++$i;?>
                                        <a href="javascript:" class="candidator <?php if($i == '1'): ?>selected <?php endif; ?>" data-info="<?php echo $voo[rule_name]; ?>|<?php echo $voo[rule_price]; ?>|<?php echo $voo[stock]; ?>|<?php echo $voo[weight]; ?>" data-ruleid="<?php echo $voo[id]; ?>"><?php echo $voo[rule_name]; ?></a>
                                      <?php endforeach; endif; else: echo "" ;endif; ?>
                                </div>
                                <div class="selectedresult">
                                    <p class="selectedstr">已选：<?php echo $info['goodsrule'][0]['rule_name']; ?> <span class='stock'>库存：<?php echo $info['goodsrule'][0]['stock']; ?></span> <span class='weight'>重量：<?php echo $info['goodsrule'][0]['weight']; ?></span></p>
                                    <p class="price"><span class="yen">¥</span> <span class="now"><?php echo $info['goodsrule'][0]['rule_price']; ?></span> </p>
                                </div>
                                <a href="javascript:" class="cartadd" data-id="<?php echo $info['id']; ?>" data-ruleid="<?php echo $info['goodsrule'][0]['id']; ?>" data-dismiss="cart" data-methods="addmore" >加入购物车</a>
                                <a href="javascript:" class="close"></a>
                        </div>
                    </div>
                </div>
            </div>
          </div>
<dd  data-ruleid="<?php echo $info['goodsrule'][0]['id']; ?>"  data-goodid="<?php echo $info['id']; ?>" style="     padding: 0;display: block;  min-height: 0;">
          <?php if(groupModel() > 0): ?>
              <div class="cartbutton" style="    bottom: 5px;">
                <span>
                  <span class="entitybutton">
                    <?php echo getRulenumhtml($info['id']); if(count($info['goodsrule']) > 1): ?>
                      <a href="javascript:" class="specadd"  ><span class="entityspecbutton"  >选规格</span></a>
                    <?php else: ?>
                      <a href="javascript:" class="oneaddcart" data-dismiss="cart" data-methods="addone" ><span class="mui-icon mui-icon-plus" style=" font-size:40px;"></span></a>
                    <?php endif; ?>
                  </span>
                </span>
            </div>

          <?php else: ?>


          <div class="cartbutton" style="    bottom: 5px;">
            <span>
              <span class="entitybutton mui-btn">
                  团购活动结束
              </span>
            </span>
        </div>
          <?php endif; ?>
</dd>



          </div>
  				<div class="mui-card-content" style="    min-height: 150px;">
  					<div class="mui-card-content-inner">


            <?php echo $info['good_desc']; ?>
              <?php echo $info['content']; ?>
  					</div>
  				</div>

  			</div>

</div>




<div class="cartmask fold-transition" _v-fd8ba416="" style="z-index: 8;display: none;"></div>
<div class="cartbody fold-transition"  style=" z-index: 9;display:none;">
    <div class="cartheader" ><span class="cartheader-text" >购物车</span> <a href="javascript:" class="cartheader-remove" ><span class="mui-icon mui-icon-trash"></span> <span >清空</span></a></div>
    <div class="cartbody-scroller" >
        <!-- <div class="piecewise-tips" ><b >阶梯配送费</b> 满70免配送费</div> -->
        <ul class="cartlist" >
        </ul>
        <script id="tpl" type="text/html">
        {{each  as value i}}
          <li class="entityrow" data-boxruleid="{{value.rule_id}}" data-boxgoodid="{{value.good_id}}"  >
            <span class="entityname" ><em class="name" >{{value.good_name}} {{value.rule_name}}</em></span>
            <span class="entitytotal" >{{value.good_price*value.num}}</span>
            <span  class="entitycartbutton">
              <span class="entitybutton">
                <a href="javascript:" data-dismiss="cart" data-methods="minusbox" data-cartid="{{value.id}}"  style="padding:0" ><span class="mui-icon mui-icon-minus"></span></a>
                <span class="entityquantity">{{value.num}}</span>
                <a href="javascript:" data-dismiss="cart" data-methods="addbox" style="padding:0" ><span class="mui-icon mui-icon-plus" ></span></a>
              </span>
            </span>
          </li>
        {{/each}}
        </script>
    </div>
</div>
<nav class="mui-bar mui-bar-tab tgou" style="      border-bottom: none;    background-color: #3d3d3f;    padding-left: 2.164384rem;">
    <span class="carticon <?php if(empty($cart['num']) || ($cart['num'] instanceof \think\Collection && $cart['num']->isEmpty())): ?>empty<?php endif; ?>"  attr-quantity="<?php echo $cart['num']; ?>"></span>
    <div class="cartprice" ><span class="carttotal" >¥<i><?php echo $cart['price']; ?></i></span> <span class="cartdelivery" ></span></div>
    <?php if($cart['price'] > config('initialdeliveryprice')): ?><a href="javascript:;" data-url="<?php echo url('index/cart/delivery'); ?>" class="submitbutton tgxd" >去结算</a>
    <?php elseif($cart['price'] == 0): ?><a href="javascript:;" data-url="" class="submitbutton" ><?php echo config('initialdeliveryprice'); ?>起送</a>
    <?php else: ?> <a href="javascript:;" data-url="" class="submitbutton" >还差<?php echo abs($cart['price'] - config('initialdeliveryprice')); ?>元</a>
    <?php endif; ?>
</nav>

<?php if(strtotime(config('grouptime')) > time()): ?>
      <script>
      var stime = "<?php echo config('grouptime'); ?>";

      var starttime = new Date(stime.replace(/-/g,"/"))
        setInterval(function () {
          var nowtime = new Date();
          var time = starttime - nowtime;
          var day = parseInt(time / 1000 / 60 / 60 / 24);
          var hour = parseInt(time / 1000 / 60 / 60 % 24);
          var minute = parseInt(time / 1000 / 60 % 60);
          var seconds = parseInt(time / 1000 % 60);
          $('.timespan').html("<span style='color:#000'>距结束:</span>"+ day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒");
        }, 1000);

      </script>
    <?php endif; ?>

</div>



<!--/#footer-->

<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/xsd/js/mui.min.js"></script>
<script src="__PUBLIC__/xsd/js/flexible.js"></script>
<script src="__PUBLIC__/xsd/js/template.js"></script>

<script type="text/javascript">
  var addUrl = "<?php echo url('index/cart/add'); ?>",
      minusUrl = "<?php echo url('index/cart/minus'); ?>",
      clearUrl="<?php echo url('index/cart/clear'); ?>",
      cartListUrl ="<?php echo url('index/cart/getCartlist'); ?>";
</script>
<script src="__PUBLIC__/xsd/js/cart.js?v=111112211211122" charset="utf-8"></script>
<script>
  $(function(){
    $(document).on('click', '.tgxd' , function(){
      var url = $(this).attr('data-url'),num = parseInt($('.carticon').attr('attr-quantity'))
      console.log($('.carticon').text());
      var subscribe = '<?php echo $subscribe; ?>';
      if(subscribe != 1){
        $.get("<?php echo url('index/getSubscribe'); ?>", function(data){
          if(data.value == 0){
            mui.alert('<img src="/public/images/qrcode_for_wx.jpg" style="width:100%;"><p style=" text-align: left;"><b>无法识别二维码</b><br />1、打开微信，点击‘添加朋友’<br />2、点击公众号<br />3、搜索公众号：贵阳鲜果屋<br />4、点击‘关注’，完成</p>', '请长按扫二维码关注公众号');
            return ;
          }else {
            if(num>0){
              window.location.href = url
            }else{
              mui.toast('请添加购买的商品！')
            }
          }
        })

      }else{
        if(num>0){
          window.location.href = url
        }else{
          mui.toast('请添加购买的商品！')
        }
      }
    })
  })

  $(function(){
    $('.pref-info').click(function(){
      var info=$(this).text()
      mui.alert(info, '公告', '关闭',function() {

      });
    })
  })

</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" charset="utf-8"></script>
<script>
    wx.config(<?php echo json_encode($options); ?>);
    wx.error(function(e){
      	console.log(e);
      });
    wx.ready(function(){
      wx.onMenuShareTimeline({
          title: "<?php echo $info['good_name']; ?>-鲜果屋",
          link: "<?php echo $crurl; ?>",
          imgUrl: "http://www.xgw0851.com/<?php echo get_cover($info['cover_id'],'path'); ?>",
      });
      wx.onMenuShareAppMessage({
          title: "<?php echo $info['good_name']; ?>-鲜果屋",
          desc: '<?php echo $info['good_brief']; ?>', // 分享描述
          link: "<?php echo $crurl; ?>",
          imgUrl: "http://www.xgw0851.com/<?php echo get_cover($info['cover_id'],'path'); ?>",

      });
    });
</script>


<?php if(!(empty(config('shop_hours')) || (config('shop_hours') instanceof \think\Collection && config('shop_hours')->isEmpty()))): ?>
<script>
  var time_range = function (beginTime, endTime) {
    var strb = beginTime.split (":");
    if (strb.length != 2) {
      return false;
    }

    var stre = endTime.split (":");
    if (stre.length != 2) {
      return false;
    }

    var b = new Date ();
    var e = new Date ();
    var n = new Date ();

    b.setHours (strb[0]);
    b.setMinutes (strb[1]);
    e.setHours (stre[0]);
    e.setMinutes (stre[1]);

    if (n.getTime () - b.getTime () > 0 && n.getTime () - e.getTime () < 0) {
      return true;
    } else {

      mui.alert("<?php echo config('shop_hours_message'); ?>", '公告');
      $('.mui-popup-buttons').html(' ')
      $('.mui-popup-inner').css('border-radius', '13px')
      return false;
    }
  }

  var shop_hours = "<?php echo config('shop_hours'); ?>";
  var hours_arr = shop_hours.split('-');
  time_range (hours_arr[0], hours_arr[1]);

</script>
<?php endif; if(config('is_rest') == '1'): ?>
<script>
mui.alert("<?php echo config('rest_message'); ?>", '公告');
$('.mui-popup-buttons').html(' ')
$('.mui-popup-inner').css('border-radius', '13px')
</script>
<?php endif; if(empty(\think\Cookie::get('positioninit')) || (\think\Cookie::get('positioninit') instanceof \think\Collection && \think\Cookie::get('positioninit')->isEmpty())): ?>
<script type="text/javascript" src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
<script>
   var geolocation = new qq.maps.Geolocation("QQ6BZ-24HC6-ZAXSZ-MTZAU-5MU2J-HEFEH", "鲜果屋");
    geolocation.getIpLocation(showPosition, showErr)
    function showPosition(position) {
      $.getJSON("<?php echo url('index/cart/changecookie'); ?>", {name: 'positioninit', 'val': position.lat+','+position.lng}, function(json, textStatus) {});
    };
    function showErr() {
      console.log('定位失败');
    };
</script>
<?php endif; ?>

<script>
  $(function(){
    $('.subsc').click(function(){
      // $.get("<?php echo url('index/clearusersession'); ?>", function(data){
      //   if(data.code == 1){
      //     window.location.href = "http://mp.weixin.qq.com/s/-AzpDTU7eAD24-R5QUP0wg"
      //   }
      // })
      <?php if(empty($contact_qc) || ($contact_qc instanceof \think\Collection && $contact_qc->isEmpty())): ?>
            mui.alert('<img src="/public/xsd/xsdwx2.jpg" style="width:100%;">', '长按扫二维码');
          <?php else: ?>
            mui.alert('<img src="<?php echo $contact_qc; ?>" style="width:100%;">', '长按扫二维码');
      <?php endif; ?>
    })


    $('.endlimit').each(function(){
      var $this = $(this);
      var stime = $this.attr('data-endtime');
      var starttime = new Date(stime.replace(/-/g,"/"))
      setInterval(function () {
        var nowtime = new Date();
        var time = starttime - nowtime;
        if(time > 0){
          var day = parseInt(time / 1000 / 60 / 60 / 24);
          var hour = parseInt(time / 1000 / 60 / 60 % 24);
          var minute = parseInt(time / 1000 / 60 % 60);
          var seconds = parseInt(time / 1000 % 60);
          $this.html("距结束还有:<span style='color:red'>"+ day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒</span>");
        }

      }, 1000);
    })

    $('.hidecartbtn').each(function(){
      var id = $(this).attr('data-id')
      $('.cartbtn'+id).hide();
    })


  })
</script>
</body>
</html>
